<template>
  <div class="Parent">
    <bmap3 
    ref="map1" 
    nameid="map1"
    :center="center"
    ></Bmap3>
  </div>
</template>

<script>
    import Bmap3 from "@/components/bmap/Bmap3.vue";
    import {getMap, addMarker} from "@/utils/bmap-utils.js";
    export default {
        name: "Bmap",
        data() {
            return {
                center: '合肥'
            }
        },
        components:{
            Bmap3
        },
        watch: {
            '$route' (from, to) {
                // console.log(from, to)
            }
        },
        mounted(){
            // flexLoadMapScript('', () => {
            //     this.isScriptLoaded = true;
            //     this.$nextTick(() => {
            //         console.log(this.$refs.map1)
            //         this.addMarker()
            //     })
            // })
        },
        methods: {
            addMarker() {
                // addMarker(this.$refs.map1['map1'], {lng:116.280190, lat: 40.049191})
                var point = new BMap.Point(116.404, 39.915);// 创建标注
                var marker = new BMap.Marker(point)
                this.$refs.map1['map1'].addOverlay(marker);             // 将标注添加到地图中
            }
        }
    }
</script>